package org.jeecg.modules.lsys.sj_data.service.impl;

import org.jeecg.modules.lsys.sj_data.entity.SjData;
import org.jeecg.modules.lsys.sj_data.mapper.SjDataMapper;
import org.jeecg.modules.lsys.sj_data.service.ISjDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 司机的数据
 * @Author: tangxz
 * @Date:   2019-10-20
 * @Version: V1.0
 */
@Service
public class SjDataServiceImpl extends ServiceImpl<SjDataMapper, SjData> implements ISjDataService {

    @Autowired
    SjDataMapper sjDataMapper;

    @Override
    public List<SjData> getAllSjData() {
        return sjDataMapper.getAllSjData();
    }

    @Override
    public int saveSjData(SjData sjData) {
        if (sjDataMapper.querySjData(sjData.getSjBh())==null) {
            return sjDataMapper.insertSjData(sjData);
        }else {
            return sjDataMapper.autoSetSjData(sjData);
        }
    }
}
